Crispo - Excel Challenge 38 2025

excel-challenges
weekly-exercises
Easy Sunday Excel Challenge
Published

September 21, 2025

Illustration for Crispo - Excel Challenge 38 2025

Challenge Description

Easy Sunday Excel Challenge

⭐ ⭐Filter Out Empty Columns

Solutions

library(tidyverse)
library(readxl)

path = "files/2025-09-21/Challenge 61.xlsx"
input = read_excel(path, range = "B2:F8")
test  = read_excel(path, range = "H2:J8")

# short but little bit difficult
result = input %>%
  select(-where(~all(is.na(.)))
         
# short and easy
result2 = input %>%
  janitor::remove_empty("cols")

all.equal(test, result, check.attributes = FALSE) # True
all.equal(test, result2, check.attributes = FALSE) # True
  • Logic:

    • Reads the workbook range needed for the challenge
  • Strengths:

    • The R solution stays compact and mirrors the workbook logic closely.
  • Areas for Improvement:

    • The code assumes the workbook layout and named ranges remain stable.
  • Gem:

    • The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd

path = "files/2025-09-21/Challenge 61.xlsx"
input = pd.read_excel(path, usecols="B:F", skiprows=1, nrows=6)
test = pd.read_excel(path, usecols="H:J", skiprows=1, nrows=6).rename(columns=lambda x: x.replace('.1', ''))

result = input.dropna(axis=1, how='all')
print(test.equals(result))   # True

result2 = input.loc[:, input.notna().any()]
print(test.equals(result2))  # True
  • Logic:

    • Reads the workbook range needed for the challenge
  • Strengths:

    • The Python version keeps the same rule in a direct pandas-oriented workflow.
  • Areas for Improvement:

    • As with the R version, any workbook layout change would require small adjustments.
  • Gem:

    • The implementation stays close to the stated challenge instead of adding unnecessary complexity.

Difficulty Level

This task is easy to moderate:

  • The business rule is readable, but the workbook still needs a few careful transformation steps.